<template>
	<div style="margin-top: 30px;width: 90%">

		<div style="position: relative;">
			<el-row>
				<el-col :span="24">

					<el-button type="primary" @click="$router.push('/merchant/merchant_list')">返回
					</el-button>
				</el-col>


			</el-row>
			<div class="editUserInfo">
				<div style="margin-right: 100px;">
					<span @click="selectAddress()">用户名:</span>
					<span style="color: blue;">{{form.userName}}</span>
				</div>
				<div style="margin-right: 100px;">
					<span>用户名ID:</span>
					<span >{{form.userId}}</span>
				</div>
				<div style="margin-right: 100px;">
					<span>认证类型:</span>
					<span v-if="form.merChantType === 'G'">个体商户</span>
					<span v-if="form.merChantType === 'M'">企业商户</span>
					<span v-if="form.merChantType === '3'">个人商户</span>
				</div>
				<div style="margin-right: 100px;">
					<span>商家状态:</span>
					<span v-if="form.actStat === '0'">审核中</span>
					<span v-if="form.actStat === '1'">平台拒绝</span>
					<span v-if="form.actStat === '2'">平台通过</span>
					<span v-if="form.actStat === '3'">快捷通拒绝</span>
					<span v-if="form.actStat === '4'">通过</span>
				</div>
				<div  v-if="form.actStat === '4' || form.actStat === '3' || form.actStat === '2'" style="align-self: center;">
					<span>快捷通商户ID:</span>
					<span>{{form.identityId}}</span>
					<!-- <span>{{stateList[form.actStat].text}}</span> -->
				</div>
			</div>
			<br>
			<div style="border: 1px solid #DCDCDC;">
				<div style="background: #f5f4f5;padding: 20px;margin-bottom: 20px;">
					实名认证
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label-width="130px" label="法人姓名：">
						<el-input  v-model="form.contact"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="法人身份证：">
						<el-input  v-model="form.idCard"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="身份证有效期：">
						<el-date-picker  v-model="form.certificatesValidity" value-format="yyyy-MM-dd" type="date" @change="getSTime" placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
					<br>
					<el-form-item label-width="130px" label="联系人手机号：">
						<el-input  v-model="form.contactNum"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="联系人邮箱：">
						<el-input  v-model="form.email"></el-input>
					</el-form-item>
					<br>
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="营业执照号：">
						<el-input  v-model="form.merCerNo"></el-input>
					</el-form-item>
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="营业执照有效期：">
						<el-date-picker  v-model="form.businessLicenseValidity" @change="getValidityTime" type="date" placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
					<el-form-item v-if="form.storeStat === 'M'" label-width="130px" label="组织机构代码号：">
						<el-input  v-model="form.organizationCode"></el-input>
					</el-form-item>
					<el-form-item v-if="form.storeStat === 'M'" label-width="130px" label="税务登记证号：">
						<el-input  v-model="form.taxRegistryNo"></el-input>
					</el-form-item>
					<br v-if="form.merChantType === 'M' || form.merChantType === 'G'">
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="门店所在地：">
						<el-input  v-model="form.areaInfo"></el-input>
					<!-- 	<el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="门店所在地址：">
						<el-input  style="width: 400px;" v-model="form.storeAddress"></el-input>
						<!-- <el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
					<br v-if="form.merChantType === 'M' || form.merChantType === 'G'">
					<el-form-item v-if="form.merChantType === '3'" label-width="130px" label="个人所在地：">
						<el-input  v-model="form.areaInfo"></el-input>
					<!-- 	<el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
					<el-form-item v-if="form.merChantType === '3'" label-width="130px" label="个人所在地址：">
						<el-input  style="width: 400px;" v-model="form.storeAddress"></el-input>
						<!-- <el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
				</el-form>
			</div>
			<br>
			<div style="border: 1px solid #DCDCDC;">
				<div style="background: #f5f4f5;padding: 20px;margin-bottom: 20px;">
					银行卡信息
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label="银行卡类型：" label-width="130px">
					    <el-select disabled  placeholder="请选择" v-model="form.companyOrPerson" style="text-align: left" >
					        <el-option label="对公" value="B" ></el-option>
					        <el-option label="对私" value="C" ></el-option>
					    </el-select>
					</el-form-item>
					<el-form-item label-width="130px" label="银行卡户名：">
						<el-input  v-model="form.bankAccountName"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="结算银行卡：">
						<el-input  v-model="form.bankAccount"></el-input>
					</el-form-item>
					<br>
					<el-form-item label-width="130px" label="选择开户行：">
						<el-select v-model="form.bankName" placeholder="请选择" @change="changeSelect">
							<el-option v-for="item in cardNameList" :key="item.name" :label="item.name" :value="item.name">
							</el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="130px" label="开户行地区：">
						<el-cascader style="width: 300px;" v-model="value" :options="optionsAddress" @change="handleChangeZone" ref="cascaderAddr"></el-cascader>
					
					</el-form-item>
					<el-form-item label-width="130px" label="开户行编号：">
						<el-input v-model="form.headBankCode"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="开户支行名称：">
						<el-input v-model="form.bankBranchName"></el-input>
					</el-form-item>

				</el-form>
			</div>
			<br>
			<div style="border: 1px solid #DCDCDC;">
				<div style="background: #f5f4f5;padding: 20px;margin-bottom: 20px;">
					影印件信息
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item v-if="form.merChantType != '3'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>营业执照:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="newBusinessLicense" :maxCount="1" :maxSize="1024*1024" @uploading="uploading3"></we-ui-uploads>
								</div>
							</div>
						</el-form-item>
						<!-- <el-form-item label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>法人身份证正面:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.idcardFront" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
								</div>
							</div>
						</el-form-item> -->
						<!-- <el-form-item label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>法人身份证反面:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.idcardBack" :maxCount="1" :maxSize="1024*1024" @uploading="uploading5"></we-ui-uploads>
								</div>
							</div>
						</el-form-item> -->
						<!-- <el-form-item v-if="form.merChantType != '3'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>银行开户许可证:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.accountLicense" :maxCount="1" :maxSize="1024*1024" @uploading="uploading6"></we-ui-uploads>
								</div>
					
							</div>
						</el-form-item> -->
						<el-form-item v-if="form.merChantType == 'M'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>组织机构代码证:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.organizationNumber" :maxCount="1" :maxSize="1024*1024" @uploading="uploading7"></we-ui-uploads>
								</div>
							</div>
						</el-form-item>
						<br v-if="form.merChantType != '3'">
						<el-form-item v-if="form.merChantType == 'M'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>税务登记证:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.tax" :maxCount="1" :maxSize="1024*1024" @uploading="uploading8"></we-ui-uploads>
								</div>
							</div>
						</el-form-item>
						<!-- <el-form-item v-if="form.merChantType == '3' || form.merChantType == 'G'">
							<div style="width: 200px;text-align: center;">
								<p>手持身份证正面:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.personPhoto" :maxCount="1" :maxSize="1024*1024" @uploading="uploading7"></we-ui-uploads>
								</div>
							</div>
						</el-form-item> -->
						<!-- <el-form-item v-if="form.merChantType == '3' || form.merChantType == 'G'">
							<div style="width: 200px;text-align: center;">
								<p>手持银行卡:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.bankCardInHand" :maxCount="1" :maxSize="1024*1024" @uploading="uploading10"></we-ui-uploads>
								</div>
							</div>
						</el-form-item> -->
					<el-form-item v-if="form.merChantType == '3'  || form.merChantType == 'G'">
							<div style="width: 200px;text-align: center;">
								<p>银行卡包含卡号一面:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.bankImage" :maxCount="1" :maxSize="1024*1024" @uploading="uploading7"></we-ui-uploads>
								</div>
							</div>
						</el-form-item>
					
						<el-form-item label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>特殊行业资质证明:</p>
								<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.specialInDustry" :maxCount="1" :maxSize="1024*1024" @uploading="uploading9"></we-ui-uploads>
								</div>
							</div>
						</el-form-item>
					

				</el-form>
			</div>
			<br>
			<div style="border: 1px solid #DCDCDC;">
				<div style="background: #f5f4f5;padding: 20px;margin-bottom: 20px;">
					其他资料
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label-width="150px" label="门店全称:">
						<el-input  v-model="form.storeName"></el-input>
					</el-form-item>
					<el-form-item label-width="150px" label="门店简称:">
						<el-input  v-model="form.merShortName"></el-input>
					</el-form-item>
					<el-form-item label-width="150px" label="门店电话:">
						<el-input  v-model="form.storePhone"></el-input>
					</el-form-item>
					<br>
					<el-form-item label-width="150px" label="门店类型：">
						<el-select  v-model="form.shopType" style="text-align: left;width: 192px;">
							<el-option label="门店" value="2"></el-option>
							<el-option label="网店" value="1"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="150px" label="商家类型：">
						<el-select v-model="form.storeType" style="width: 192px;">
							<el-option :label="item.paramName" :value="item.paramKey" v-for="item in typeList"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="150px" label="补贴比例:">
						<el-select v-model="form.storeRebate" style="width: 192px;margin-right: 30px;">
						    <el-option :label="item.text" :value="item.value" v-for="item in scalePublicData"></el-option>
						</el-select>
						<!-- <el-input v-model="form.storeRebate"></el-input> -->
					</el-form-item>
					<el-form-item label-width="150px" label="营业时间:">
						<el-time-select  placeholder="起始时间" v-model="startTime" :picker-options="{
					 	    start: '00:00',
					 	    step: '00:15',
					 	    end: '23:45'
					 	  }">
						</el-time-select>
						<el-time-select  placeholder="结束时间" v-model="endTime" :picker-options="{
					 	    start: '00:00',
					 	    step: '00:15',
					 	    end: '23:45'
					 	  }">
						</el-time-select>
					</el-form-item>
				
					<el-form-item label-width="150px" label="经营类目:">
						<el-select  v-model="form.businessClass" style="width: 200px;" @change="selectSort2()" placeholder="一级分类">
							<el-option :label="item.classifyName" :value="item.classifyId" v-for="(item, index) in sortList" :key="index"></el-option>
						</el-select>
						<el-select  v-model="form.businessSubclass" style="width: 200px;" placeholder="二级分类">
							<el-option :label="item.classifyName" :value="item.classifyId" v-for="(item, i) in secondList" :key="i"></el-option>
						</el-select>
					</el-form-item>
					<br>
					<el-form-item v-if="form.actStat === '1'" label-width="150px" label="拒绝理由:">
						<el-input readonly style="width: 600px;" v-model="form.refuseReason" type="textarea" :rows="2"></el-input>
					</el-form-item>
					<el-form-item v-if="form.actStat === '3'" label-width="150px" label="拒绝理由:">
						<el-input readonly style="width: 600px;" v-model="form.failReason" type="textarea" :rows="2"></el-input>
					</el-form-item>
					<el-form-item label-width="150px" label="商家简介:">
						<el-input  style="width: 600px;" v-model="form.introduction" type="textarea" :rows="3"></el-input>
					</el-form-item>
					<br>
					<el-form-item label-width="150px">
						<div style="width: 200px;text-align: center;">
							<p>商家封面图:</p>
							<div style="display: inline-block;text-align: center">
								<!-- <img style="width: 100px;height: 100px;margin-right: 10px;" v-for="(item,index) in form.storeImg" :key="index" :src="item" alt=""> -->
								<we-ui-uploads :images="form.storeImg"  :maxCount="1" :maxSize="1024*1024" @uploading="uploading"></we-ui-uploads>
							</div>
						</div>
					</el-form-item>
					<el-form-item label-width="150px">
						<div style="width: 600px;text-align: left;">
							<p>商家图片:</p>
							<div >
								<!-- <img style="width: 100px;height: 100px;margin-right: 10px;" v-for="(item,index) in form.storegList" :key="index" :src="item" alt=""> -->
								<we-ui-uploads :images="form.storegList" :maxCount="9" :maxSize="1024*1024" @uploading="uploading2"></we-ui-uploads>
							</div>
							
						</div>
					</el-form-item>

				</el-form>
			</div>
			<br>
			<div style="border: 1px solid #DCDCDC;">
				<div style="background: #f5f4f5;padding: 20px;margin-bottom: 20px;">
					快捷通审核资料
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label-width="150px">
						<div style="width: 200px;text-align: center;">
							<p>商家官网截图:</p>
							<div style="display: inline-block;text-align: center">
								<we-ui-uploads :images="networdUrlPhotostr" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
								<!-- <img style="width: 100px;height: 100px;margin-right: 10px;" v-for="(item,index) in networdUrlPhotostr" :key="index" :src="item" alt=""> -->
							</div>
						</div>
					</el-form-item>
				</el-form>
				
				<div style="display: flex;justify-content: space-between;padding: 30px 70px;border-top: 1px solid #DCDCDC;">
					<div>
						<el-button @click="submitForm" type="primary">确定修改信息</el-button>
					</div>
					
					<div>
						<el-button v-if="form.actStat === '0'" :loading="loading" type="success" @click="agree">同意</el-button>
						<el-button v-if="form.actStat === '3' || form.actStat === '1'" type="infor" @click="reloadSubmit">重新提交</el-button>
						<el-button v-if="form.actStat === '0'" type="danger" :loading="loading" @click="dialogVisible=true;">拒绝</el-button> 
					</div>
				</div>
			</div>
			<br>

			<div style="width: 100%;height: 50px;"></div>


		</div>
		<el-dialog title="拒绝理由" v-model="dialogVisible" size="tiny" style="min-width: 400px">
		      <el-form label-width="110px">          
		          <el-form-item label="拒绝理由：" >
		                 <el-input  v-model="refuseReason" class="length_150"></el-input>
		          </el-form-item>
		    </el-form>
		     <div style="text-align: center">
		         <el-button type="primary" @click="submit" :disabled="!refuseReason" :loading="loading">保 存
		         </el-button>
		     </div>
		     
		</el-dialog>   

		<div class="weui-gallery" style="display: block;z-index: 9999;" v-show="img.is_preview">
			<span class="weui-gallery__img" :style="{backgroundImage:img.preview_url,transform:img.transform}" @click="hidePreview"></span>
			<div class="weui-gallery__opr white_pointer">
				<div class="weui-gallery__del" @click.prevent="rotate()">
					<img src="../../assets/images/xuanzhuan.png" height="25" width="25">
					<span class="weui-span_del">旋转</span>
				</div>
			</div>
		</div>
	</div>

</template>
<style>

</style>

<script>
	import address from '../../address.js'
	export default {
		data() {
			return {
				loading: false,
				form: {
					storeId: '',
					storeName: '',
					storePhone: '',
					storeAddress: '',
					businessTime: '',
					businessClass: '',
					businessSubclass: '',
					introduction: '',
					businessLicense: '',
					storegList: [],
					storeImg: [],
					storeRebate: '',
					idcardFront: [],
					idcardBack: [],
					accountLicense: [],
					organizationNumber: [],
					tax: [],
					specialInDustry: [],
					bankProvince: '',
					companyOrPerson: '',
					appData: '',
					businessLicenseValidity: '',
					networdUrlPhoto: ''
				},
				value: ['110000', '110100'],
				proportion: [
					{
						text: '0%',
						value: 0
					},
					{
						text: '1%',
						value: 0.01
					},
					{
						text: '2%',
						value: 0.02
					},
					{
						text: '3%',
						value: 0.03
					},
					{
						text: '4%',
						value: 0.04
					},
					{
						text: '5%',
						value: 0.05
					},
					{
						text: '6%',
						value: 0.06
					},
					{
						text: '7%',
						value: 0.07
					},
					{
						text: '8%',
						value: 0.08
					}, 
					{
						text: '9%',
						value: 0.09
					},
					{
						text: '10%',
						value: 0.1
					},
					{
						text: '11%',
						value: 0.11
					},
					{
						text: '12%',
						value: 0.12
					},
					{
						text: '13%',
						value: 0.13
					},
					{
						text: '14%',
						value: 0.14
					},
					{
						text: '15%',
						value: 0.15
					},
					{
						text: '16%',
						value: 0.16
					}
				],
				sortList: [],
				secondList: [],
				startTime: '',
				typeList: [{
					text: '物流商超',
					value: '1'
				}, {
					text: '服务行业',
					value: '2'
				}, {
					text: '酒店',
					value: '3'
				}],
				endTime: '',
				userName: '',
				dialogVisible: false,
				id: '',
				show: '',
				storeImgList: [],
				contactNum: '',
				contact: '',
				cantclick: false,
				msgCode: '',
				img: {
					is_preview: false,
					preview_url: '',
					image_index: null,
					preview_images: [],
					transform: ''
				},
				refuseReason: '',
				stateList: [{
						text: '审核中',
						value: '0'
					},
					{
						text: '平台拒绝',
						value: '1'
					},
					{
						text: '平台通过',
						value: '2'
					},
					{
						text: '快捷通拒绝',
						value: '3'
					},
					{
						text: '通过',
						value: '4'
					}
				],
				cardNameList: [{
						"name": "农业银行",
						"code": "ABC"
					},
					{
						"name": "中国银行",
						"code": "BOC"
					},
					{
						"name": "建设银行",
						"code": "CCB"
					},
					{
						"name": "工商银行",
						"code": "ICBC"
					},
					{
						"name": "交通银行",
						"code": "COMM"
					},
					{
						"name": "中信银行",
						"code": "CITIC"
					},
					{
						"name": "光大银行",
						"code": "CEB"
					},
					{
						"name": "华夏银行",
						"code": "HXB"
					},
					{
						"name": "民生银行",
						"code": "CMBC"
					},
					{
						"name": "广东发展银行",
						"code": "GDB"
					},
					{
						"name": "平安银行",
						"code": "SZPAB"
					},
					{
						"name": "招商银行",
						"code": "CMB"
					},
					{
						"name": "兴业银行",
						"code": "CIB"
					},
					{
						"name": "浦东发展银行",
						"code": "SPDB"
					},
					{
						"name": "南京银行",
						"code": "NJCB"
					},
					{
						"name": "宁波银行",
						"code": "NBCB"
					},
					{
						"name": "汉口银行",
						"code": "HKBCHINA"
					},
					{
						"name": "杭州银行",
						"code": "HCCB"
					},
					{
						"name": "广州市商业银行",
						"code": "GZCB"
					},
					{
						"name": "浙江稠州商业银行",
						"code": "CZCB"
					},
					{
						"name": "长沙银行",
						"code": "CSCB"
					},
					{
						"name": "城市商业银行",
						"code": "CITYBANK"
					},
					{
						"name": "上海银行",
						"code": "BOS"
					},
					{
						"name": "北京银行",
						"code": "BCCB"
					},
					{
						"name": "晋城市商业银行",
						"code": "SXJS"
					},
					{
						"name": "温州市商业银行",
						"code": "WZCB"
					},
					{
						"name": "广州市农信社",
						"code": "GNXS"
					},
					{
						"name": "农村商业银行",
						"code": "RCB"
					},
					{
						"name": "顺德农信社",
						"code": "SDE"
					},
					{
						"name": "恒丰银行",
						"code": "EGBANK"
					},
					{
						"name": "浙商银行",
						"code": "CZB"
					},
					{
						"name": "农村合作银行",
						"code": "URCB"
					},
					{
						"name": "渤海银行",
						"code": "CBHB"
					},
					{
						"name": "徽商银行",
						"code": "HSBANK"
					},
					{
						"name": "村镇银行",
						"code": "COUNTYBANK"
					},
					{
						"name": "重庆三峡银行",
						"code": "CCQTGB"
					},
					{
						"name": "上海农村商业银行",
						"code": "SHRCB"
					},
					{
						"name": "城市信用合作社",
						"code": "UCC"
					},
					{
						"name": "北京农商行",
						"code": "BJRCB"
					},
					{
						"name": "珠海市农村信用合作社",
						"code": "ZHNX"
					},
					{
						"name": "尧都信用合作联社",
						"code": "YDXH"
					},
					{
						"name": "深圳农村商业银行",
						"code": "SNXS"
					},
					{
						"name": "农村信用合作社",
						"code": "RCC"
					},
					{
						"name": "湖南农信社",
						"code": "HNNXS"
					},
					{
						"name": "中国邮储银行",
						"code": "PSBC"
					},
					{
						"name": "浙江省农村信用社联合社",
						"code": "ZJRC"
					},
					{
						"name": "河南农村信用社",
						"code": "HNNX"
					},
					{
						"name": "江苏农村信用社联合社",
						"code": "JSNX"
					},
					{
						"name": "吉林省农村信用社",
						"code": "JLNLS"
					},
					{
						"name": "河北省农村信用社",
						"code": "HEBNX"
					},
					{
						"name": "内蒙古农村信用社",
						"code": "NMGNXS"
					},
					{
						"name": "辽宁省农村信用社",
						"code": "LNRCC"
					},
					{
						"name": "云南省农村信用社",
						"code": "YNRCC"
					},
					{
						"name": "湖北农村信用社",
						"code": "HBXH"
					},
					{
						"name": "广东农村信用社",
						"code": "GDRC"
					},
					{
						"name": "海南省农村信用社",
						"code": "HNB"
					},
					{
						"name": "山西农村信用社",
						"code": "SXRCU"
					},
					{
						"name": "安徽农村信用社联合社",
						"code": "AHRCU"
					},
					{
						"name": "山东省农村信用社",
						"code": "SDNXS"
					},
					{
						"name": "四川农村信用社",
						"code": "SCRCU"
					},
					{
						"name": "广西农村信用社",
						"code": "GXNXS"
					},
					{
						"name": "陕西农村信用社",
						"code": "SXNXS"
					},
					{
						"name": "福建农村信用社",
						"code": "FJNX"
					},
					{
						"name": "江西农村信用社",
						"code": "JXNXS"
					},
					{
						"name": "贵州农信社",
						"code": "GZRCU"
					},
					{
						"name": "黑龙江农村信用社",
						"code": "HLJRCC"
					},
					{
						"name": "新疆农信社",
						"code": "XJRCCB"
					},
					{
						"name": "青海农信社",
						"code": "QHRCCB"
					},
					{
						"name": "甘肃省农村信用社",
						"code": "GSRCU"
					},
					{
						"name": "浙江民泰商业银行",
						"code": "MTB"
					},
					{
						"name": "哈尔滨银行",
						"code": "HRBCB"
					},
					{
						"name": "中原银行",
						"code": "ZYB"
					},
					{
						"name": "贵阳银行",
						"code": "GYB"
					},
					{
						"name": "郑州银行",
						"code": "ZZBANK"
					},
					{
						"name": "成都银行",
						"code": "BOCD"
					},
					{
						"name": "重庆银行",
						"code": "CQCBANK"
					},
					{
						"name": "青岛银行",
						"code": "QDB"
					},
				],
				optionProps: {
					label: 'label',
					value: 'value',
					children: 'children'
				},
				newBusinessLicense: [],
				optionsAddress: address(),
				readonly: false,
				networdUrlPhotostr: [],
				agreeLoading: false,
			}
		},
		created() {
			this.selectSort()
		},
		activated() {
			if (sessionStorage.getItem('address') != null) {
				let info = JSON.parse(sessionStorage.getItem('address'))
				this.form.storeAddress = decodeURI(info.storeAddress)
				this.form.areaNum = info.areaNum
				this.form.storeAccu = info.storeDime
				this.form.storeDime = info.storeAccu
				sessionStorage.removeItem('address')
			} else if (sessionStorage.getItem('keep') == 1) {
				sessionStorage.removeItem('keep')
			} else {
				this.loading = false
				this.newBusinessLicense = []
				this.fetchData()
			}

		},
		methods: {
			changeSelect(e) {
				this.cardNameList.forEach(item => {
					if(item.name == e) {
						this.form.headBankCode = item.code
					}
				})
			},
			handleChangeZone(e) {

				let str = this.$refs['cascaderAddr'].currentLabels.toString()
				str = str.replace(/,/g, "")
				this.form.bankProvince = str
			},
			fetchData() {
				this.dataApi.ajax('singlemerchantForKjt', {
					userId: this.$route.query.id
				}, res => {
					if (res.responseType === 'S') {
						this.form = res
						if (this.storeImgList.length > 0) {
								this.form.storeImgList = []
								for (var i = 0; i < this.storeImgList.length; i++) {
									this.form.storegList.push(this.storeImgList[i].imgUrl)
								}
							} else {
						
							}
							for (let i = this.form.storegList.length - 1; i >= 0; i--) {
						
								if (this.form.storegList[i] == undefined) {
									this.form.storegList.splice(i, 1);
								}
							}
							if(this.form.personPhoto != '' && this.form.personPhoto != undefined) {
								let personPhotostr = this.form.personPhoto
								let personPhotoarr = personPhotostr.split(',')
								this.form.personPhoto = personPhotoarr
							} else {
								this.form.personPhoto = []
							}
							if(this.form.networdUrlPhoto == undefined){
								this.form.networdUrlPhoto = []
								this.networdUrlPhotostr = []
							}
							if(this.form.networdUrlPhoto != '' && this.form.networdUrlPhoto != undefined) {
								let networdUrlPhotostr = this.form.networdUrlPhoto
								let networdUrlPhotoarr = networdUrlPhotostr.split(',')
								this.form.networdUrlPhoto = networdUrlPhotoarr
								this.networdUrlPhotostr = this.form.networdUrlPhoto
							} else {
								this.networdUrlPhotostr = []
							}
							if(this.form.bankCardInHand != ''  && this.form.bankCardInHand != undefined) {
								let bankCardInHandstr = this.form.bankCardInHand
								let bankCardInHandarr = bankCardInHandstr.split(',')
								this.form.bankCardInHand = bankCardInHandarr
							} else {
								this.form.bankCardInHand = []
								
							}
							if(this.form.bankImage != '' && this.form.bankImage != undefined){
								let bankImagestr = this.form.bankImage
								let bankImagearr = bankImagestr.split(',')
								this.form.bankImage = bankImagearr
							} else{
								this.form.bankImage = []
							}
							if(this.form.idcardBack != '' && this.form.idcardBack != undefined) {
								let str = this.form.idcardBack
								let arr = str.split(',')
								this.form.idcardBack = arr
							} else{
								this.form.idcardBack = []
							}
							// if(this.form.businessLicense != ''){
							// 	let businessLicensestr = this.form.businessLicense
							// 	let businessLicensearr = businessLicensestr.split(',')
							// 	this.form.businessLicense = businessLicensearr
							// } else{
							// 	this.form.businessLicense = []
							// }
							if (this.form.businessLicense != '' && this.form.businessLicense != undefined) {
								this.newBusinessLicense.push(this.form.businessLicense)
								// let businessLicensestr = this.form.businessLicense
								// let businessLicensearr = businessLicensestr.split(',')
								// this.form.businessLicense = businessLicensearr
							} else {
								this.newBusinessLicense = []
							}
							if(this.form.accountLicense != '' && this.form.accountLicense != undefined) {
							
								let accountLicensestr = this.form.accountLicense
								let accountLicensearr = accountLicensestr.split(',')
								this.form.accountLicense = accountLicensearr
							}else{
							
								this.form.accountLicense =  []
								
							}
							if(this.form.organizationNumber != '' && this.form.organizationNumber != undefined) {
								let organizationNumberstr = this.form.organizationNumber
								let organizationNumberarr = organizationNumberstr.split(',')
								this.form.organizationNumber = organizationNumberarr
							}else{
							
								this.form.organizationNumber = []
							}
							if(this.form.storeImg != '' && this.form.storeImg != undefined) {
								
								let storeImgstr = this.form.storeImg
								let storeImgarr = storeImgstr.split(',')
								this.form.storeImg = storeImgarr
							} else {
								this.form.storeImg = []
							}
							if(this.form.idcardFront != '' && this.form.idcardFront != undefined) {
								
								let idcardFrontstr = this.form.idcardFront
								let idcardFrontarr = idcardFrontstr.split(',')
								this.form.idcardFront = idcardFrontarr
							} else{
								this.form.idcardFront =  []
							}
							if (this.form.businessTime != '' && this.form.businessTime != undefined) {
								this.startTime = this.form.businessTime.split('-')[0]
								this.endTime = this.form.businessTime.split('-')[1]
							}
							if(this.form.tax != '' && this.form.tax != undefined) {
								let taxstr = this.form.tax
								let taxarr = taxstr.split(',')
								this.form.tax = taxarr
							}else {
								this.form.tax = []
								
							}
						if(this.form.specialInDustry == '' || this.form.specialInDustry == undefined) {
							this.form.specialInDustry = []
						} else {
							let specialInDustrystr = this.form.specialInDustry
							let specialInDustryarr = specialInDustrystr.split(',')
							this.form.specialInDustry = specialInDustryarr
						}
						this.getAddressCode()
						this.show = true

					}
				});
			},
			// 获取开户行地区code用于回显
			getAddressCode() {
				var vm = this
				let arrAddress = []
				vm.optionsAddress.forEach(item => {
					if(item.label === vm.form.bankProvince) {
						arrAddress[0] = item.value
						item.children.forEach(ite => {
							if(ite.label == vm.form.bankCity) {
								arrAddress[1] = ite.value
								vm.value = arrAddress
							}
						})
					}
				})
			},
			getSTime(val) {
				this.form.certificatesValidity = val
			},
			getValidityTime(val) {
				this.form.businessLicenseValidity = val
			},
			submitForm() {
				if (!this.form.storeName) {
					this.showMsg('请输入商家名称', 'warning')
					return;
				}

				if (!this.form.storeAddress) {
					this.showMsg('请选取门店地址', 'warning')
					return;
				}

				if (!this.form.businessClass || !this.form.businessSubclass) {
					this.showMsg('请选择分类', 'warning')
					return;
				}
				// if (this.form.storeImg.length == 0) {
				// 	this.showMsg('请上传商家封面图片', 'warning')
				// 	return false;
				// }
				// if (this.form.idcardFront.length == 0) {
				// 	this.showMsg('请上传法人身份证正面图片', 'warning')
				// 	return false;
				// }
				// if (this.form.idcardBack.length == 0) {
				// 	this.showMsg('请上传法人身份证反面图片', 'warning')
				// 	return false;
				// }
				// if (this.form.personPhoto.length == 0 && this.form.merChantType == '3') {
				// 	this.showMsg('请上传手持身份证正面图片', 'warning')
				// 	return false;
				// }
				if (this.newBusinessLicense.length == 0 && this.form.merChantType == 'M') {
					this.showMsg('请上传营业执照图片', 'warning')
					return false;
				}
				if (this.form.storegList.length < 3 ) {
					this.showMsg('商家图片最低3张', 'warning')
					return false;
				}
				// if (this.form.accountLicense.length == 0 && this.form.merChantType != '3') {
				// 	this.showMsg('请上传银行开户许可证图片', 'warning')
				// 	return false;
				// }
				// if (this.form.organizationNumber.length == 0 && this.form.merChantType != '3') {
				// 	this.showMsg('请上传组织机构代码证图片', 'warning')
				// 	return false;
				// }
				// if (this.form.tax.length == 0 && this.form.merChantType != '3') {
				// 	this.showMsg('请上传税务登记证图片', 'warning')
				// 	return false;
				// }
				let data = generateObj(this.form)
				console.log(this.form)
				var arr = data.specialInDustry
				var str = arr.join(',');
				data.specialInDustry = str
				var arr1 = data.tax
				var str1 = arr1.join(',');
				data.tax = str1
				var arr2 = data.organizationNumber
				var str2 = arr2.join(',');
				data.organizationNumber = str2
				var arr3 = data.accountLicense
				var str3 = arr3.join(',');
				data.accountLicense = str3
				var arr4 = data.idcardFront
				var str4 = arr4.join(',');
				data.idcardFront = str4
				var arr5 = data.idcardBack
				var str5 = arr5.join(',');
				data.idcardBack = str5
				var arr6 = this.newBusinessLicense
				var str6 = arr6.join(',');
				data.businessLicense = str6
				// console.log(data.businessLicense,'审核营业执照')
				if	(this.networdUrlPhotostr.length != '0') {
					var arr7 = this.networdUrlPhotostr
					var str7 = arr7.join(',');
					data.networdUrlPhoto = str7
				} else{
					let strnetwordUrlPhoto = ''
					data.networdUrlPhoto = strnetwordUrlPhoto
				}
				if (data.personPhoto.length != 0) {
					var arrpersonPhoto = data.personPhoto
					var strpersonPhoto = arrpersonPhoto.join(',');
					data.personPhoto = strpersonPhoto
				} else{
					let strPhoto = ''
					console.log(strPhoto)
					data.personPhoto = strPhoto
				}
				if (data.bankCardInHand.length != 0) {
					var arrbankCardInHand = data.bankCardInHand
					var strbankCardInHand = arrbankCardInHand.join(',');
					data.bankCardInHand = strbankCardInHand
				}else{
					let Hand = ''
					console.log(Hand)
					data.bankCardInHand = Hand
				}
				var arrbankImage = data.bankImage
				var strbankImage = arrbankImage.join(',');
				data.bankImage = strbankImage
				data.storeImg = data.storeImg.toString()
				var storeImgList = []
				for (var i = data.storegList.length - 1; i >= 0; i--) {
					for (var j = this.storeImgList.length - 1; j >= 0; j--) {
						if (this.storeImgList[j].imgUrl == data.storegList[i]) {
							storeImgList.push(this.storeImgList[j].imgUrl)
							break;
						}
					}
				}
				this.optionsAddress.forEach(item => {
					if (item.value === this.value[0]) {
						data.bankProvince = item.label
						item.children.forEach(ite => {
							if (ite.value == this.value[1]) {
								data.bankCity = ite.label
							}
						})
						
					}
				})
				data.storeImgList = storeImgList.reverse()
				
				for(let i=data.storegList.length-1; i>=0; i--){
				    if(data.storegList[i] == undefined){
				        data.storegList.splice(i,1);
				    }
				}

				console.log(this.startTime)
				if (this.startTime && !this.endTime) {
					data.businessTime = this.startTime + '-'
				} else if (this.endTime && !this.startTime) {
					data.businessTime = '-' + this.endTime
				} else if (this.startTime && this.endTime) {
					data.businessTime = this.startTime + '-' + this.endTime
				} else {
					data.businessTime = ''
				}
				console.log(data, '提交保存信息')
				this.loading = true
				this.dataApi.ajax('merchantEditForKjt', data, res => {
					if (res.responseType === 'S') {
						this.showMsg('保存成功')
						this.loading = false
						this.$router.push('/merchant/merchant_list')
					}
				});

			},
			selectSort() {
				this.dataApi.ajax('selectStoreClassify', {
					parentId: 0
				}, res => {
					if (res.responseType === 'S') {
						this.sortList = res.dtos
					}
				});
				this.dataApi.ajax('selectStore', null, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.typeList = res.dtos
					}
				});

			},
			selectSort2() {
				if (this.show) {
					this.form.businessSubclass = this.form.businessSubclass
					this.show = false
				} else {
					this.form.businessSubclass = ''
				}
				this.dataApi.ajax('selectStoreClassify', {
					parentId: this.form.businessClass
				}, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.secondList = res.dtos
					}
				});


			},
			uploading(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading3(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading4(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading5(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading6(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading10(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading7(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading8(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading9(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					if (res.responseType == 'S') {
						console.log(this.form)
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading2(f) {
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					if (res.responseType == 'S') {
					f.images.splice(f.index, 1, res.filePath)
						this.storeImgList.push({
							imgHeight: res.height,
							imgUrl: res.filePath,
							imgWidth: res.width
						})
						this.loading = false
					}
				});

			},
			// selectAddress() {
			// 	this.$router.push('/merchant/map')
			// 	sessionStorage.setItem('keep', '1')
			// },
			// activate() {
			// 	this.dialogVisible = true
			// },
			// find() {
			// 	this.dataApi.ajax('singleUser', {
			// 		userId: this.id
			// 	}, res => {
			// 		if (res.responseType === 'S') {
			// 			this.userName = res.userName
			// 		}
			// 	});
			// },
	submit(){
		if(this.refuseReason == ''){
			this.showMsg('请输入拒绝理由')
		}
	    this.loading=true
	    this.dataApi.ajax('platformPreliminaryTrial',{ 
	      storeId:this.form.storeId,
	      applyStat:1,
	      refuseReason:this.refuseReason
	     }, res => {
	        if (res.responseType === 'S') {
	            this.showMsg('拒绝成功')
	            this.dialogVisible=false;
				this.newBusinessLicense = []
	            this.fetchData();
	        }
	        this.loading=false
	      }); 
	},
			hidePreview() {
				this.img.is_preview = false;
				this.img.preview_url = null;
				this.img.image_index = null;
				this.img.preview_images = [];
				this.img.transform = '';
			},
			// 重新提交
			reloadSubmit() {
				this.agree()
			},
			agree() {
				this.loading = true
				if	(this.networdUrlPhotostr.length > 0) {
					var arr7 = this.networdUrlPhotostr
					var str7 = arr7.join(',');
					this.form.networdUrlPhoto = str7
				}else{
					this.showMsg('请上传官网图', 'warning')
					return false
				}
				this.dataApi.ajax('platformPreliminaryTrial', {
					storeId: this.form.storeId,
					applyStat: 2,
					networdUrlPhoto: this.form.networdUrlPhoto
				}, res => {
					if (res.responseType === 'S') {
						this.loading = false
						this.showMsg("通过成功")
						this.newBusinessLicense = []
						this.fetchData();
					}else{
						this.loading = false
					}
				})
			}
		}
	}
</script>
<style>
	.editUserInfo {
		display: flex;
		justify-content: flex-start;
		padding: 20px;
		border: 1px solid #DCDCDC;
		margin-top: 20px;
	}
</style>
